
library(spgwr)
data("meuse")
meuse<-meuse[,1:8]

library(dplyr)
predata<-apply(meuse,2,mean)%>%as.data.frame%>%t%>%as.data.frame
coordinates(predata)<-c('x','y')

col.bw<-gwr.sel(cadmium~dist,data = meuse,coords = cbind(meuse$x,meuse$y))
fit<-gwr(cadmium~dist,data = meuse,coords = cbind(meuse$x,meuse$y),bandwidth = col.bw,hatmatrix = TRUE)
pre<-gwr(cadmium~dist,data = meuse,coords = cbind(meuse$x,meuse$y),bandwidth = col.bw,predictions = TRUE,fit.points = predata,fittedGWRobject = fit)

pre$SDF$pred
